load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

cc_library(
    name = "boost.lockfree_test_lib",
    testonly = True,
    deps = [
        "//:boost.lockfree",
        "@boost.interprocess",
        "@boost.test//:unit_test_main",
        "@boost.thread",
    ],
)

cc_test(
    name = "destructor_test",
    srcs = ["destructor_test.cpp"],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "freelist_test",
    srcs = [
        "freelist_test.cpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "queue_bounded_stress_test",
    srcs = [
        "queue_bounded_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [
        ":boost.lockfree_test_lib",
    ],
)

cc_test(
    name = "queue_fixedsize_stress_test",
    srcs = [
        "queue_fixedsize_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "queue_interprocess_test",
    srcs = ["queue_interprocess_test.cpp"],
    tags = ["manual"],  # doesn't work on Debian
    deps = [
        ":boost.lockfree",
        "@boost.interprocess",
        "@boost.thread",
    ],
)

cc_test(
    name = "queue_test",
    srcs = ["queue_test.cpp"],
    tags = ["manual"],  # doesn't work on Mac
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "queue_unbounded_stress_test",
    srcs = [
        "queue_unbounded_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "spsc_queue_stress_test",
    srcs = [
        "spsc_queue_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "spsc_queue_test",
    srcs = [
        "spsc_queue_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "stack_bounded_stress_test",
    srcs = [
        "stack_bounded_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "stack_fixedsize_stress_test",
    srcs = [
        "stack_fixedsize_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "stack_interprocess_test",
    srcs = ["stack_interprocess_test.cpp"],
    tags = ["manual"],  # doesn't work on Debian
    deps = [
        ":boost.lockfree",
        "@boost.interprocess",
    ],
)

cc_test(
    name = "stack_test",
    srcs = ["stack_test.cpp"],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "stack_unbounded_stress_test",
    srcs = [
        "stack_unbounded_stress_test.cpp",
        "test_common.hpp",
        "test_helpers.hpp",
    ],
    deps = [":boost.lockfree_test_lib"],
)

cc_test(
    name = "tagged_ptr_test",
    srcs = ["tagged_ptr_test.cpp"],
    deps = [":boost.lockfree_test_lib"],
)
